﻿#region Copyright information
// 
// Copyright © 2012-2013 Yongkee Cho. All rights reserved.
// 
// This code is a part of the SubnetworkToolkit and governed under the terms of the
// GNU Lesser General  Public License (LGPL) version 2.1 which accompanies this distribution.
// For more information on the LGPL, please visit http://bol.codeplex.com/license.
// 
// - Filename: GeneSet.cs
// - Author: Yongkee Cho
// - Email: yongkeecho@outlook.com
// - Date Created: 2013-01-30 2:55 PM
// - Last Modified: 2013-01-30 3:21 PM
// 
#endregion
using System;
using System.Collections.Generic;
using System.Linq;

namespace SubnetworkToolkit
{
    public class GeneSet
    {
        public string Name { get; private set; }

        public string Description { get; private set; }

        public IEnumerable<Gene> Genes { get; set; }

        public GeneSet(string name, string description, IEnumerable<Gene> genes)
        {
            if (name == null)
                throw new ArgumentNullException("name");
            if (description == null)
                throw new ArgumentNullException("description");
            if (genes == null)
                throw new ArgumentNullException("genes");

            Name = name;
            Description = description;
            Genes = genes;
        }

        public GeneSet(string name, IEnumerable<Gene> genes)
            : this(name, String.Empty, genes) { }

        public override string ToString()
        {
            return Genes.Any(x => x.Id.Equals(-1)) ? String.Join(", ", Genes.Select(x => x.Symbol)) : String.Join(", ", Genes);
        }
    }
}